<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <table>
        <tr>
            <td><input type="text" placeholder="请输入用户名" class="UserName"></td>
        </tr>
        <tr>
            <td><input type="text" placeholder="请输入密码" class="password"></td>
        </tr>
        <tr>
            <td><input type="button" value="登录" onclick="login()"></td>
            <td><input type="button" value="注册" onclick="zhuce()"></td>
        </tr>
    </table>
</body>
</html>
<script src="js/jquery-3.6.0.min.js"></script>
<script>
    function login(){
        let user01={
            name:'root',
            pwd:'123456'
        }
        let uName=$('.UserName').val()
        let pword=$('.password').val()
        if(uName===user01.name && pword===user01.pwd){
            location.href='index.html'
        }else{
            alert('密码错误')
        }
    }
</script>